package com.ynny.service;


import com.ynny.dao.IUserDao;
import com.ynny.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    IUserDao userDao;
    @Override
    public int register(User user) {
        //判断用户名是否重复
        User checkUsername = userDao.checkUsername(user.getUsername());
        if (checkUsername != null){
            return 212;
        }
        //添加用户
        int i = userDao.add(user);
        if (i != 1){
            return 213;
        }


        return 200;
    }
}